gin框架写rest接口特别6,性能也很好。
本文介绍一下gin和gorilla结合创建websocket
1. gin
github地址:https://github.com/gin-gonic/gin
安装gin的代码包
go get github.com/gin-gonic/gin
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
bindAddress := "localhost:2303"
r := gin.Default()
//监听 get请求 /test路径
r.GET("/test", func(c *gin.Context) {
c.JSON(200,[]